function roundm(n, m) {
    return Math.floor((n + m - 1) / m) * m;
}

// 圆
function getRandomPointInCircle(radius, tile_size) {
    let t = 2 * Math.PI * Math.random();
    let u = Math.random() + Math.random();
    let r = 0;
    if (u > 1) {
        r = 2 - u;
    } else {
        r = u;
    }
    return [roundm(radius * r * Math.cos(t), tile_size), roundm(radius * r * Math.sin(t), tile_size)];
}

// 椭圆
function getRandomPointInEllipse(ellipse_width, ellipse_height, tile_size) {
    let t = 2 * Math.PI * Math.random();
    let u = Math.random() + Math.random();
    let r = 0;
    if (u > 1) {
        r = 2 - u;
    } else {
        r = u;
    }
    return [roundm(ellipse_width * r * Math.cos(t) / 2, tile_size), roundm(ellipse_height * r * Math.sin(t) / 2, tile_size)];
}